
//
//  ProjectPickerModel.m
//  XiaoMiao
//
//  Created by jinglian on 2018/2/28.
//  Copyright © 2018年 smallyou. All rights reserved.
//

#import "ProjectPickerModel.h"
#import "ProjectSeletedModel.h"
#import "ProjectPickerSubModel.h"
#import "BRAddressModel.h"

@implementation ProjectPickerModel



+ (NSDictionary *)objectClassInArray {
    return @{@"citylist": @"ProjectPickerSubModel"};
}


+ (NSArray <ProjectPickerModel *>*)projectPickerModelsFormProjectSeletedModels:(NSArray <ProjectSeletedModel *>*)projectSeletedModels {
    NSMutableArray *projectPickerModels = [NSMutableArray array];
    
    for (ProjectSeletedModel *seletedModel in projectSeletedModels) {
        //
        BRProvinceModel *pickerModel = [[BRProvinceModel alloc] init];
        pickerModel.ID = seletedModel.id;
        pickerModel.provinceName = seletedModel.name;
        
        [projectPickerModels addObject:pickerModel];
        
        
        //
        NSMutableArray *projectPickerSubModels = [NSMutableArray array];
        
        for (ProjectSeletedModel *subSeletedModel in seletedModel.cateViews) {
            NSMutableArray *projectPickerSubSubModels = [NSMutableArray array];
            BRCityModel *pickerSubModel = [[BRCityModel alloc] init];
            pickerSubModel.ID = subSeletedModel.id;
            pickerSubModel.cityName = subSeletedModel.name;
            
            
            for (ProjectSeletedModel *subSubSeletedModel in subSeletedModel.cateViews) {
                
                BRAreaModel *pickerSubSubModel = [[BRAreaModel alloc] init];
                pickerSubSubModel.ID = subSubSeletedModel.id;
                pickerSubSubModel.areaName = subSubSeletedModel.name;
                
                [projectPickerSubSubModels addObject:pickerSubSubModel];
            }
            
            pickerSubModel.arealist = projectPickerSubSubModels;
            
            [projectPickerSubModels addObject:pickerSubModel];
        }
        
        pickerModel.citylist = projectPickerSubModels;
    }
     
    return projectPickerModels;
}

@end
